<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Currency Entity Creation</title>
<script type="text/javascript" src="Javascript/Currency.js"></script>
<LINK REL="stylesheet" HREF="CSS/Main.css" TYPE="text/css">
<LINK REL="stylesheet" HREF="CSS/Button.css" TYPE="text/css">
</head>
<body>

	<div id="top">
		<h1>Master Data Management</h1>
		<br>
		<a id="log" href="logout">Logout</a><br>
    		<%@ include file="redirection.jsp" %>
		<div id="menu">
	      <ul>
	        <li>
	        	<form action = "logout" method="post">
					<a><input type="submit" name="Logout" value="Logout"></a>
				</form>
			</li>
	      </ul>
	    </div>
	</div>
		<h2>Currency Entity Creation</h2>
			<%String[][] cur = (String[][]) request.getAttribute("curdetails");
			String status = (String) request.getAttribute("status"); %>
<article id="warning"></article><br>
<div id="left">
		<div class="box">
			<%
					if (cur == null && status == null) {
				%>
				<form name='header' action='CurrencyCreate' method="get">
					<script type="text/javascript">
						document.forms['header'].submit();
					</script>
				</form>
				<%
					}
				%>
				<br>
			<form action="CurrencyCreate" method="post" onsubmit="return validate()">
				<table>
					<tr>
						<td>Currency Name</td>
						<td><input type="text" id="Currency" name="Currency" required></td>
					</tr>
					<tr>
						<td>Description</td>
						<td><input type="text" name="Description"></td>
					</tr>
		
				</table>
				<input type="submit" class="button" name="submit" value="submit">
				<br>
			<article><%=(request.getAttribute("status")==null) ? "":request.getAttribute("status")%></article>
			</form>
		</div>
		<div class="visbox">
			<form action="ControlPanel.jsp">
				<input type="submit" class="button" name="Back" value="Back">
			</form>
			<br>
			<%if(session.getAttribute("role").equals("admin")){%>
				<form action="Home.jsp">
					<input type="submit" class="button"name="Home" value="Home">
				</form>		
			<%}else{%>
				<form action="HomeUser.jsp">
					<input type="submit" class="button"name="Home" value="Home">
				</form>	
			<% }%>	
		</div>
	</div>
	<div id="right">
				<form action="CurrencyCreate" method="get">
					<table border="1" width="600">
						<tr>
							<th>Currency</th>
							<th>Details</th>
							<%if(session.getAttribute("role").equals("admin")){%>
								<th>Flag</th>
								<%}%>
						</tr>
								<%if(cur!=null){
									
									for(String[] s:cur){%>
									<tr>
										<td><%=s[0]%></td>
										<td><%=s[1]%></td>
										<%if(session.getAttribute("role").equals("admin")){%>
											<%String f = s[2]; 
					if(f.equals("Y")){%>
						<td>Yes</td>
					<%}else{ %>
						<td>No</td>
						<%} %> 
										<%}%>
									</tr>
								<%}}%>
					</table>
				</form>
	</div>
</body>
</html>
